#ifndef MYMOVIEAPI_H
#define MYMOVIEAPI_H

#include <QObject>
#include "mymovieresponseparse.h"
#include "loaddisctitlebyidresponseparser.h"
#include "settings.h"
class MyMovieApi : public QObject
{
    Q_OBJECT
public:
    explicit MyMovieApi(QObject *parent = 0);
    explicit MyMovieApi(const QString discId,bool includeAdult,bool includeEnglish,int locale,QObject *parent= 0);
    ~MyMovieApi();
    QList<DiscData> getMyMovieId(QString paramDiscId="");
    QList<MovieData> searchMyMovieIdByTitle(QString title,QString country, int  type, int results,bool strict);
    QList<DiscData> searchDiscTitleByTitle(QString title,QString country, int  type, int results,bool strict);

    void addNewRippedDisc(bool parentalControl);
    bool isAlreadyRipped(QString idMyMovie);
    QString setCurrentDiscIn(QString idDisc);
    bool setCurrentDiscOut(QString id);
    void setPercentage(QString id,int percentage);

    DiscTitle loadDiscTitleById(QString id);

    void setPath(QString path);
    QString getPath();
    void setTitleId(QString titleId);
    QString getTitleId();
    QString getDiscId();
    void setDiscId(QString value);

    int getCurrentCommand(QString idDisc);

    enum typeMedia{
        Blu_ray,
        DVD
    };
signals:
    //from MyMovies
    void titleIdResponsed(QList<DiscData>response);
    void titleIdUnknown();
    void movieDataResponsed(QList<MovieData>response);
    void movieUnknown();

    //from PelicanoC
    void newRippedDiscSent();
    void alreadyRipped(QString idMyMovie);
public slots:
    void assignPath(QString path);

    //from MyMovies
    void requestTitleId(QByteArray paramDiscId);
    void requestMovieData(QString title,QString country, int  type, int results,bool strict);
    void requestSearchDiscTitleByTitle(QString title,QString country, int  type, int results,bool strict);

    //from PelicanoC
    void sendNewRippedDisc(QString id, QString path, QString discId, bool parentalControl);
    void requestIsAlreadyRipped(QString idMyMovie);

private:
    QString _discId;
    bool _includeAdult;
    bool _includeEnglish;
    int _locale;
    QList<DiscData> _lastResponse;
    QString _path;
    QString _titleId;

    char* _endpoint;

};

#endif // MYMOVIEAPI_H
